<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script type="text/javascript" src="./themes/default/js/jquery.min.js"></script>
	<script type="text/javascript">

	$(document).ready(function(){
		$("#form_login").submit(function(e){
			return false;// 返回
		});
		$("#sub_form_login").click(function() {
			$.post("service_login.php",{username : $("#username").val(), password : $("#password").val()}, function(data){
				var s_html = "";
				if (data.status == 0) {
					s_html = "<div id=\"hello\" style=\"background:red;width:200px;height:24px;margin:auto;\">" + data.rtn_username;
					s_html += "<input id=\"logout\" type=\"button\" value=\"退出\" onclick=\"logout();\" />" + "</div>";
					$("#wrap_login").remove();
					$("#area_login").append(s_html);
				} else if (data.status == 1) {
					s_html = "<div id=\"hello\" style=\"background:red;width:200px;height:24px;margin:auto;\">" + data.rtn_username + "</div>";
					$("#wrap_login").remove();
					$("#area_login").append(s_html);
				} else if (data.status == 2) {
					alert("请通过正规渠道登录本系统！");
				} else if (data.status == 3) {
					alert("用户：" + data.pre_username + " 已经登录。请勿重复登录。");
					s_html = "<div id=\"hello\" style=\"background:red;width:200px;height:24px;margin:auto;\">" + data.rtn_username + "</div>";
					$("#wrap_login").remove();
					$("#area_login").append(s_html);
				} else if (data.status == 4) {
					alert("用户：" + data.pre_username + " 已经登录。请勿重复登录。");
					s_html = "<div id=\"hello\" style=\"background:red;width:200px;height:24px;margin:auto;\">" + data.rtn_username + "</div>";
					$("#wrap_login").remove();
					$("#area_login").append(s_html);
				}else if (data.status == 5) {
					alert("验证失败，请重新输入！");
				}else if (data.status == 6) {
					alert("用户：" + data.pre_username + " 已经登录。请勿重复登录。");
					s_html = "<div id=\"hello\" style=\"background:red;width:200px;height:24px;margin:auto;\">" + data.rtn_username + "</div>";
					$("#wrap_login").remove();
					$("#area_login").append(s_html);
				}
			}, 'json');
		});		
	});

	  
	</script>

    <title>符动乾坤 -- 测试代码</title>
  </head>
  <body>
	
	<div id="area_login" style="width:420px;height:24px;margin:auto;">
	  <div id="wrap_login">
		<form method="post" action="./service_login.php" id="form_login">
		  名称:&nbsp; <input type="text" id="username" name="username" style="width:128px;height:24px;margin:0;padding:0; border: solid black 1px;box-sizing:border-box;vertical-align:middle;border-right:1;" />
		  &nbsp;密码:&nbsp;&nbsp;<input type="password" id="password" name="password" style="width:128px;height:24px;margin:0;padding:0;border: solid black 1px;box-sizing:border-box;vertical-align:middle;border-right:1;" />
		  <input type="submit" value="提交" id="sub_form_login" style="width:48px;height:24px;margin:0;padding:0;border: solid black 1px;vertical-align:middle;" />
		</form>
	  </div>
	</div>

  </body>
</html>




